package Fenetres;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import ClassesJava.Personne;
import DAO.PersonneDAO;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import java.awt.Font;
import java.awt.Image;

import javax.swing.JTextArea;
import java.awt.Color;
import javax.swing.JScrollPane;
import java.awt.SystemColor;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Fenetre_Resultats extends JFrame {

	private JPanel contentPane;
	private Fenetre_Recherche recherche;
	private PersonneDAO personneDAO;
	protected JTextArea txtrText;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Fenetre_Resultats frame = new Fenetre_Resultats();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Fenetre_Resultats() {
		this.setTitle("ESIGELEC Security - Resultats");
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(500, 100, 620, 605);
		contentPane = new JPanel_Background();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		Image icon2 = new ImageIcon(this.getClass().getResource("/left-arrow.png")).getImage();
		
		txtrText = new JTextArea();
		txtrText.setBackground(SystemColor.menu);
		txtrText.setEditable(false);
		txtrText.setText("Text");
		
		JScrollPane scrollPane = new JScrollPane(txtrText);
		scrollPane.setBounds(111, 41, 385, 403);
		contentPane.add(scrollPane);
		
		JButton button = new JButton("Supprimer");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			
			int retour = 0;
			retour = personneDAO.supprimer(recherche.UnePersonne);
			JOptionPane.showMessageDialog(null, retour + " Personne supprime", "Resultat", JOptionPane.INFORMATION_MESSAGE);
				
			}
		});
		button.setFont(new Font("Century Gothic", Font.PLAIN, 16));
		button.setBounds(391, 491, 133, 36);
		contentPane.add(button);
		
		JButton btnRetour = new JButton("  Retour");
		btnRetour.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
			}
		});
		btnRetour.setIcon(new ImageIcon(icon2));
		btnRetour.setFont(new Font("Century Gothic", Font.PLAIN, 16));
		btnRetour.setBounds(82, 491, 133, 36);
		contentPane.add(btnRetour);
		
		JButton btnCharger = new JButton("Charger");
		btnCharger.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
			}
		});
		btnCharger.setFont(new Font("Century Gothic", Font.PLAIN, 16));
		btnCharger.setBounds(237, 491, 133, 36);
		contentPane.add(btnCharger);

	}
}
